import readline from "readline";
import process from "process";

export class ReadTerminal {
  RL: readline.Interface;

  constructor() {
    this.RL = readline.createInterface({input: process.stdin, output: process.stdout});
  }

  public whiteTerminal(text: string): Promise<string> {
    return new Promise<string>((resolve) => {
      this.RL.question(text, (result) => {
        resolve(result);
      })
    })
  }

  public closeTerminal() {
    this.RL.close();
  }
}
